package com.deer.wms.ware.task.model.pushErp.enter;

import com.deer.wms.base.system.model.OrderToErpBO;
import com.deer.wms.ware.task.model.SO.SoDetail;
import com.deer.wms.ware.task.model.SO.SoMaster;
import com.deer.wms.ware.task.model.enums.ErpType;
import com.deer.wms.ware.task.model.pushErp.AbstractPushErpBean;
import com.deer.wms.ware.task.service.PushErpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;
import java.util.Optional;

/**
 * @Author: xu
 * @Date: 2022/06/16/22:40
 * @Description: 其他出库生产投料单
 */
@Component
public class ElseFeed extends AbstractPushErpBean {

    @Autowired
    private PushErpService pushErpService;
    //251300021-生产投料单 ==> 29-其他出库单；
    public ErpType gainType() {
        return new ErpType(251300021, 29);
    }
    protected  Boolean front(SoMaster soMaster, List<SoDetail> soDetail ){
        return true;
    }
    /**
     * 字段添加
     *  @param orderToErpBO
     * @param
     * @param
     */
    @Override
    protected void add(OrderToErpBO orderToErpBO, SoMaster soMaster, Map<String, SoDetail> soDetailMap) {
        orderToErpBO.setDeptId(Optional.ofNullable(soMaster.getDeptId()).orElse(null));
    }
    protected void pushErp(OrderToErpBO orderToErpBO){
        pushErpService.pushIMBIll(orderToErpBO);
    }

}
